<template>
  <el-table :data="state.dataList" v-loading="state.loading" border
            :cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle"
            @sort-change="sortChangeHandle">
    <el-table-column type="index" label="#" width="40"/>
    <el-table-column prop="text" :label="$t('qms.testItemCode')" show-overflow-tooltip/>
    <el-table-column prop="value" :label="$t('qms.testItem')" show-overflow-tooltip/>
    <el-table-column prop="selected" :label="$t('qms.standardValue')" show-overflow-tooltip/>
    <el-table-column prop="selected" :label="$t('qms.testData')" show-overflow-tooltip/>
  </el-table>
</template>

<script setup lang="ts">
//  table hook
import {BasicTableProps, useTable} from "/@/hooks/table";
import {listDicItemById} from "/@/api/platform/digital/basDicSet";

const state: BasicTableProps = reactive<BasicTableProps>({
  isPage: false,
  dataList: []
})

// 刷新表格
const refresh = (id) => {
  listDicItemById(id).then(res => {
    state.dataList = res.data
  })
}

const {
  sortChangeHandle,
  tableStyle
} = useTable(state)

// 暴露变量
defineExpose({
  refresh
});

</script>

<style scoped lang="scss">

</style>